/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Entidades;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Miguel
 */
@Entity
@Table(name = "catedratico")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Catedratico.findAll", query = "SELECT c FROM Catedratico c"),
    @NamedQuery(name = "Catedratico.findByNumeroCatedratico", query = "SELECT c FROM Catedratico c WHERE c.numeroCatedratico = :numeroCatedratico"),
    @NamedQuery(name = "Catedratico.findByNombre", query = "SELECT c FROM Catedratico c WHERE c.nombre = :nombre"),
    @NamedQuery(name = "Catedratico.findByApellidos", query = "SELECT c FROM Catedratico c WHERE c.apellidos = :apellidos"),
    @NamedQuery(name = "Catedratico.findByTelefono", query = "SELECT c FROM Catedratico c WHERE c.telefono = :telefono"),
    @NamedQuery(name = "Catedratico.findByCreditos", query = "SELECT c FROM Catedratico c WHERE c.creditos = :creditos"),
    @NamedQuery(name = "Catedratico.findByAnulado", query = "SELECT c FROM Catedratico c WHERE c.anulado = :anulado"),
    @NamedQuery(name = "Catedratico.findBySueldo", query = "SELECT c FROM Catedratico c WHERE c.sueldo = :sueldo")})
public class Catedratico implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "numeroCatedratico")
    private Integer numeroCatedratico;
    @Basic(optional = false)
    @Column(name = "nombre")
    private String nombre;
    @Basic(optional = false)
    @Column(name = "apellidos")
    private String apellidos;
    @Column(name = "telefono")
    private String telefono;
    @Basic(optional = false)
    @Column(name = "creditos")
    private short creditos;
    @Column(name = "anulado")
    private Boolean anulado;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "sueldo")
    private Float sueldo;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "catedraticoidCatedratico")
    private Collection<Horariocatedratico> horariocatedraticoCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "catedraticoidCatedratico")
    private Collection<Cursoposible> cursoposibleCollection;
    @OneToMany(mappedBy = "catedraticoidCatedratico")
    private Collection<Asignacionseccioncurso> asignacionseccioncursoCollection;
    @JoinColumn(name = "GradoAcademico_idGradoAcademico", referencedColumnName = "idGradoAcademico")
    @ManyToOne(optional = false)
    private Gradoacademico gradoAcademicoidGradoAcademico;

    public Catedratico() {
    }

    public Catedratico(Integer numeroCatedratico) {
        this.numeroCatedratico = numeroCatedratico;
    }

    public Catedratico(Integer numeroCatedratico, String nombre, String apellidos, short creditos) {
        this.numeroCatedratico = numeroCatedratico;
        this.nombre = nombre;
        this.apellidos = apellidos;
        this.creditos = creditos;
    }

    public Integer getNumeroCatedratico() {
        return numeroCatedratico;
    }

    public void setNumeroCatedratico(Integer numeroCatedratico) {
        this.numeroCatedratico = numeroCatedratico;
    }

    public String getNombre() {
        return nombre;
    }

    public void setNombre(String nombre) {
        this.nombre = nombre;
    }

    public String getApellidos() {
        return apellidos;
    }

    public void setApellidos(String apellidos) {
        this.apellidos = apellidos;
    }

    public String getTelefono() {
        return telefono;
    }

    public void setTelefono(String telefono) {
        this.telefono = telefono;
    }

    public short getCreditos() {
        return creditos;
    }

    public void setCreditos(short creditos) {
        this.creditos = creditos;
    }

    public Boolean getAnulado() {
        return anulado;
    }

    public void setAnulado(Boolean anulado) {
        this.anulado = anulado;
    }

    public Float getSueldo() {
        return sueldo;
    }

    public void setSueldo(Float sueldo) {
        this.sueldo = sueldo;
    }

    @XmlTransient
    public Collection<Horariocatedratico> getHorariocatedraticoCollection() {
        return horariocatedraticoCollection;
    }

    public void setHorariocatedraticoCollection(Collection<Horariocatedratico> horariocatedraticoCollection) {
        this.horariocatedraticoCollection = horariocatedraticoCollection;
    }

    @XmlTransient
    public Collection<Cursoposible> getCursoposibleCollection() {
        return cursoposibleCollection;
    }

    public void setCursoposibleCollection(Collection<Cursoposible> cursoposibleCollection) {
        this.cursoposibleCollection = cursoposibleCollection;
    }

    @XmlTransient
    public Collection<Asignacionseccioncurso> getAsignacionseccioncursoCollection() {
        return asignacionseccioncursoCollection;
    }

    public void setAsignacionseccioncursoCollection(Collection<Asignacionseccioncurso> asignacionseccioncursoCollection) {
        this.asignacionseccioncursoCollection = asignacionseccioncursoCollection;
    }

    public Gradoacademico getGradoAcademicoidGradoAcademico() {
        return gradoAcademicoidGradoAcademico;
    }

    public void setGradoAcademicoidGradoAcademico(Gradoacademico gradoAcademicoidGradoAcademico) {
        this.gradoAcademicoidGradoAcademico = gradoAcademicoidGradoAcademico;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (numeroCatedratico != null ? numeroCatedratico.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Catedratico)) {
            return false;
        }
        Catedratico other = (Catedratico) object;
        if ((this.numeroCatedratico == null && other.numeroCatedratico != null) || (this.numeroCatedratico != null && !this.numeroCatedratico.equals(other.numeroCatedratico))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return this.numeroCatedratico +" - "+this.getNombre()+", "+this.getApellidos();
    }
    
}
